package com.thread.test06;

/**
 * @author bin
 * @date 2025 - 03 -10
 **/
public class MianTest {
    public static void main(String[] args) throws InterruptedException {
        int count = 1000;
        int[][] arr= {{1,100},{101,900},{901,1000}};

        long totalSum = 0;
        for (int i = 0; i < arr.length; i++) {
            Sum sum = new Sum(arr[i][0],arr[i][1]);
            Thread tr =  new Thread(sum);
            tr.start();
            tr.join();
            totalSum += sum.getSum();
            System.out.println(sum.getSum());
        }

        System.out.println("1 到 " + count + " 的总和是: " + totalSum);
    }
}
